package com.api.controller;


import com.api.common.utils.Result;
import com.api.entity.Tag;
import com.api.entity.TbMenu;
import com.api.entity.dto.TagDTO;
import com.api.service.AreaService;
import com.api.service.ITagService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * <p>
 * 标签表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-09-28
 */
@RestController
@RequestMapping("/api/tag")
@AllArgsConstructor
public class TagController {
    private  final ITagService tagService;
    @GetMapping
    @Operation(summary = "列表")
    public Result list() {
        List<Tag> list = tagService.list();
        ArrayList<String> cate = new ArrayList<>();
        for (Tag tag : list) {
            cate.add(tag.getName());
        }


        //返回列表
        ArrayList<TagDTO> dto = new ArrayList<>();
        TagDTO tagDTO = new TagDTO();
        tagDTO.setName("类型");
        tagDTO.setValue(cate);


        //添加
        dto.add(tagDTO);
        return new Result().ok(dto);
    }
}
